Component({
  data: {
    list: '1'.repeat(30).split('').map(Number),
    height: 0,
    h: null,
  },
  lifetimes: {
    attached() {
      this.createIntersectionObserver().relativeTo('#scrollarea').observe('#container', (res) => {
        console.debug('交叉变化', res);
      });
    },
  },
  methods: {
    switchLen() {
      const list = this.data.list.length === 1 ? '1'.repeat(30).split('').map(Number) : [1];
      this.setData({
        list,
        h: list.length > 1 ? null : 3,
      });
    },
    switchHeight() {
      this.setData({
        height: this.data.height === 0 ? 100 : 0,
        h: this.data.list.length > 1 ? null : (this.data.h === 1 ? 2 : 1),
      });
    },
  },
});
